import Vue from 'vue'
import VueRouter from 'vue-router'
import home from '../views/index.vue'
import comm from '../views/CommodityView.vue'
import user from '../views/UserView.vue'
// import Echarts from '../views/EchartsView.vue'
import login from '../views/LoginView.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'login',
    component: login,
  },
  {
        path:"/home",
        name:'home',
        component:home,//父级路由
        redirect:"/home/comm",
        children:[
          // {
          //   path:'/',
          //   redirect:"comm" //重定向到 comm 子路由
          // },
          {
            path:'comm',
            name:'商品管理',
            component:comm
          },
          {
            path:'user',
            name:'用户管理',
            component:user
          },
        ]
  }

]

const router = new VueRouter({
  routes
})

export default router
